<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="${pageContext.request.contextPath}/static/js/jquery-3.5.1.min.js"></script>
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/vue/vue.min.js"></script>
</head>


<body>
<div id="app">
    <h3 style="text-align: left;color: #2D93CA" id="aas">修改信息</h3>
    <div class="row">
        <div class="col-md-4 column">
            <a class="btn btn-primary" style="margin-left: 20px"
               href="${pageContext.request.contextPath}/admin/touser">显示借阅人信息</a>
        </div>
        <div class="col-md-3">
            <form action="#" method="post">
                <div class="form-group">
                    <label for="a1">账号</label><input class="form-control" type="text" autocomplete="off"
                                                     required="required"
                                                     readonly
                                                     value="${user.userName}" id="a1"/>
                </div>
                <div class="form-group">
                    <label for="a2">密码</label><input class="form-control" type="password" autocomplete="off" required
                                                     value="${user.userPassword}"
                                                     id="a2"/>
                </div>
                <div class="form-group">
                    <label for="a3">邮箱</label><input class="form-control" type="text" autocomplete="off"
                                                     required="required"
                                                     value="${user.userEmail}"
                                                     id="a3"/>
                </div>
                <div class="form-group">
                    <label for="a4">住址</label><input class="form-control" type="text" autocomplete="off"
                                                     required="required"
                                                     value="${user.userAddress}"
                                                     id="a4"/></div>
                <div class="form-group">
                    <label for="a5">电话</label><input class="form-control" type="number" maxlength="11"
                                                     autocomplete="off"
                                                     required="required"
                                                     value="${user.userTelephonenumber}" id="a5"/>
                </div>
            </form>
            <p>
                <btnt msg="确认提交"></btnt>
                <%--                确认提交--%>
            </p>
        </div>
    </div>
    <div
            class="modal fade"
            id="myModal"
            tabindex="-1"
            role="dialog"
            aria-labelledby="myModalLabel"
            aria-hidden="true"
    >
        <div class="modal-dialog mid-center col-md-pull-1">
            <div class="modal-content">
                <div class="modal-header">
                    <button
                            type="button"
                            class="close"
                            data-dismiss="modal"
                            aria-hidden="true"
                    >
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel">确认操作</h4>
                </div>
                <div class="modal-body">确认此次操作吗</div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">
                        关闭
                    </button>
                    <button id="a6" type="button" class="btn btn-primary" data-dismiss="modal">提交更改</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal -->
    </div>
</div>
</body>
<script src="${pageContext.request.contextPath}/static/vue/btnt.js"></script>
<script>
    $("#a6").click(function () {
        // alert("提交中")
        $.ajax({
            type: "post",
            url: "${pageContext.request.contextPath}/admin/updateUserMessage",
            data: {
                userName: $("#a1").val(),
                userPassword: $("#a2").val(),
                userEmail: $("#a3").val(),
                userAddress: $("#a4").val(),
                userTelephonenumber: $("#a5").val()
            },
            dataType: "text",
            success: function (res) {
                alert(res);
            },
            error: function () {
                alert("出错了");
            }
        });
    });
</script>

</html>
